//
//  WebViewController.m
//  MyProject
//
//  Created by 石小强 on 2018/4/26.
//  Copyright © 2018年 yanjiaming. All rights reserved.
//

#import "WebViewController.h"

@interface WebViewController ()

@end

@implementation WebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = self.titleStr;
    if (_isWord) {
        if (self.url.length > 0) {
            NSString *encodedValue = [self.url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
            NSURL *url = [NSURL URLWithString:encodedValue];
            NSURLRequest *request = [NSURLRequest requestWithURL:url];
            [self.webView loadRequest:request];
            self.webView.scalesPageToFit = YES;
        }
    }else{
        if (self.url.length > 0) {
            NSURL *url = [NSURL URLWithString:self.url];
            NSURLRequest *request = [NSURLRequest requestWithURL:url];
            [self.webView loadRequest:request];
        }
    }
   
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
    [self showProgressWithView:self.view animated:YES];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [self hideProgress:self.view animated:YES];
}

- (void)doBack:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
    [self.navigationController popViewControllerAnimated:YES];
}

@end
